{% extends "base.html" %}
{% block content %}

{% if selects|length == 0 %}
	{% include 'include/getstarted.html' %}
{% else %}
<link href="/inc/table.css" rel="stylesheet" type="text/css">
<script type="text/javascript" charset="utf8" src="/inc/dataTables.min.js"></script>
<center>
	<p>
		<form action="{{ action }}" method="post">
			<input type="hidden" value="{{service}}" name="service" id="service">
			{% include 'include/select.html' %}
				<a class="ui-button ui-widget ui-corner-all" title="Open versions" onclick="showListOfVersion(1)">Open</a>
				<a href="config.py?service={{service}}" class="ui-button ui-widget ui-corner-all" title="Configs page">Configs</a>
			{% if service != 'keepalived' %}
				<a class="ui-button ui-widget ui-corner-all" title="View stat" onclick="openStats()">Stat</a>
			{% endif %}
			<a class="ui-button ui-widget ui-corner-all" title="Change version" onclick="changeVersion()">Change version</a>
		</form>
	</p>
	{% if aftersave %}
		<div class="alert alert-info"><b>The following files have been deleted:</b><br /> </div>
		{% if stderr %}
			{% include 'include/errors.html' %}
		{% else %}
			<div class="alert alert-success">
			{% for f in file %}
				{{f}}
			{% endfor %}
			</div>
		{% endif %}
	{% endif %}
	<div id="config_version_div"></div>
	{% if not aftersave %}
		<div class="add-note addName alert-info" style="width: inherit; margin-right: 15px; margin-top: 40%">
			Here you can work with previous versions of {{ service[0]|upper}}{{service[1:] }} configs. Roll back to them, view or delete
		</div>
	{% endif %}
	{% if open and not aftersave %}
	{% for select in selects %}
		{% if select.2 == serv %}
			<script>showListOfVersion(1)</script>
		{% endif %}
	{% endfor %}
	{% endif %}
</center>
{% endif %}
{% endblock %}
